<script setup>
import { ref } from 'vue'
import requests from '@/api/ajax.js'
import { useRouter } from 'vue-router'
const router_useRouter = useRouter()


const handleClick = () => {
  console.log('click')
}


const options = [
  {
    value: 'guide',
    label: 'Guide',
  },
  {
    value: 'component',
    label: 'Component',
  },
  {
    value: 'resource',
    label: 'Resource',
  },
]

const tableData = [
  {
    date: '2016-05-03',
    name: 'Tom',
    address: 'No. 189, Grove St, Los Angeles',
  },
  {
    date: '2016-05-02',
    name: 'Tom',
    address: 'No. 189, Grove St, Los Angeles',
  },
  {
    date: '2016-05-04',
    name: 'Tom',
    address: 'No. 189, Grove St, Los Angeles',
  },
  {
    date: '2016-05-01',
    name: 'Tom',
    address: 'No. 189, Grove St, Los Angeles',
  },
  {
    date: '2016-05-08',
    name: 'Tom',
    address: 'No. 189, Grove St, Los Angeles',
  },
  {
    date: '2016-05-06',
    name: 'Tom',
    address: 'No. 189, Grove St, Los Angeles',
  },
  {
    date: '2016-05-07',
    name: 'Tom',
    address: 'No. 189, Grove St, Los Angeles',
  },
  {
    date: '2016-05-01',
    name: 'Tom',
    address: 'No. 189, Grove St, Los Angeles',
  },
  {
    date: '2016-05-08',
    name: 'Tom',
    address: 'No. 189, Grove St, Los Angeles',
  },
  {
    date: '2016-05-06',
    name: 'Tom',
    address: 'No. 189, Grove St, Los Angeles',
  },
  {
    date: '2016-05-07',
    name: 'Tom',
    address: 'No. 189, Grove St, Los Angeles',
  },
]

function changeCourses(val){
  const acd = requests({ url: "/course/taskBase/"+val, method: "get"}).then(res => {
            //存储用户信息到浏览器toke
          const abc = res.data.rdata
          taskList.value = abc
    })
    .catch(err => {
        console.error(err.data);
        // 登录请求失败后的操作
    })
}
/* 
const tableData = ref([{
  companyName:'',
  majorName:'',
  edu_system:'',
  graduateDate:'',
}])

onBeforeMount (() =>{

//请求能够发出组队邀请的学生信息
  const aacom = requests({ url: "/outer/campany", method: "get",}).then(res => {
          //存储用户信息到浏览器toke
          const abc =res.rdata
          tableData.value = abc
          console.log(res)
  })
  .catch(err => {
      console.error(err.data);
      // 登录请求失败后的操作
  });
}) */

function adc (){
    router_useRouter.push({ path: 'schemaCourse' })
  }


const schemaName = ref('')
const teachObjective = ref('')
const teachArrangment = ref('')

</script>


<template>
  <div class="ordering">
    <div class="heading">课程大纲发布</div>
    <div>
      <el-table :data="tableData" height="350" style="width: 100%">
        <el-table-column prop="class" label="班级" min-width="100" />
        <el-table-column prop="majorName" label="专业" min-width="100" />
        <el-table-column prop="edu_system" label="学制" min-width="100" />
        <el-table-column prop="graduateDate" label="毕业年份" min-width="100" />
      </el-table> 
    </div>
    <div>
      <!-- 下部部输入框 -->
      <el-row :gutter="20" style=" margin-top: 20px; ">
        <el-col :span="4">
          <div class="grid-content ep-bg-purple">
            <el-select class="m-2" placeholder="选择企业" @change="changeCourses">
              <el-option v-for="item in classNum" :key="item.scheduleId" :label="item.className"
                :value="item.scheduleId" />
            </el-select>
          </div>
        </el-col>
        <el-col :span="4">
          <div class="grid-content ep-bg-purple">
            <el-select class="m-2" placeholder="选择企业老师" :change="add">
              <el-option v-for="item in courseOptions" :key="item.courseId" :label="item.courseName"
                :value="item.courseId" />
            </el-select>
          </div>
        </el-col>
        <!-- 开始时间 -->
        <el-col :span="4">
          <div class="grid-content ep-bg-purple">
            <el-date-picker type="date" placeholder="安排时间" format="YYYY/MM/DD" value-format="YYYY-MM-DD" />
          </div>
        </el-col>
        <el-col>
          <div class="grid-content ep-bg-purple">
            <el-input v-model="schemaName" :rows="2" type="textarea" placeholder="大纲名称" style="margin-top: 8px;" />
            <el-input v-model="teachObjective" :rows="2" type="textarea" placeholder="教学目标" style="margin-top: 8px;" />
            <el-input v-model="teachArrangment" :rows="2" type="textarea" placeholder="教学安排" style="margin-top: 8px;" />
            <el-button type="primary" @click="coursePublish"
              style="margin-top: 8px; background-color: #545c64;">发布</el-button>
            <el-button type="primary" @click="adc"
              style="margin-top: 8px; background-color: #545c64;">返回</el-button>
          </div>
        </el-col>
      </el-row>
    </div>
  </div>
</template>



<style scoped></style>
